package routers

import (
	"demo/middleware/jwt"
	"demo/routers/api"
	"github.com/gin-gonic/gin"
)

func InitRouter() *gin.Engine {
	r := gin.Default()
	r.Use(gin.Logger())
	r.Use(gin.Recovery())
	articleApi := r.Group("/api/articles")
	articleApi.Use(jwt.JWT())
	{
		articleApi.GET("/list")
		articleApi.GET("/detail", api.GetDetail)
	}
	accountApi := r.Group("/api/account")
	{
		accountApi.GET("/login")
	}
	accountApi.Use(jwt.JWT())
	{
		accountApi.GET("/info")
	}
	return r
}
